//
//  ZLPSubDeatilTableViewCellOne.m
//  TangYi
//
//  Created by dllo on 15/10/29.
//  Copyright © 2015年 赵连鹏. All rights reserved.
//

#import "ZLPSubDeatilTableViewCellOne.h"
#define WIDTH self.contentView.frame.size.width

@implementation ZLPSubDeatilTableViewCellOne

- (void)dealloc {
    [_picImageView release];
    [_descLabel release];
    [_tagLabel release];
    [_tagImageView release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.picImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.picImageView];
    [_picImageView release];
    
    self.descLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.descLabel];
    self.descLabel.numberOfLines = 0;
    self.descLabel.font = [UIFont systemFontOfSize:15];
    self.descLabel.textColor = [UIColor grayColor];
    [_descLabel release];
    
    self.tagLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.tagLabel];
    self.tagLabel.textColor = [UIColor redColor];
    self.tagLabel.font = [UIFont systemFontOfSize:13];
    self.tagLabel.numberOfLines = 0;
    [self.tagLabel sizeToFit];
    [_tagLabel release];
    
    self.tagLabel1 = [[UILabel alloc] init];
    [self.contentView addSubview:self.tagLabel1];
    self.tagLabel1.textColor = [UIColor redColor];
    self.tagLabel1.font = [UIFont systemFontOfSize:13];
    self.tagLabel1.numberOfLines = 0;
    [_tagLabel1 release];
    
    self.tagLabel2 = [[UILabel alloc] init];
    [self.contentView addSubview:self.tagLabel2];
    self.tagLabel2.textColor = [UIColor redColor];
    self.tagLabel2.font = [UIFont systemFontOfSize:13];
    self.tagLabel2.numberOfLines = 0;
    [_tagLabel2 release];
    
    self.tagImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.tagImageView];
    [_tagImageView release];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.picImageView.frame = CGRectMake(0, 0, WIDTH, WIDTH);
    
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:15], NSFontAttributeName, nil];
    CGRect rect = [self.descLabel.text boundingRectWithSize:CGSizeMake(375, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];

    self.descLabel.frame = CGRectMake(5, WIDTH + 5, WIDTH - 10, rect.size.height);
    
    self.tagImageView.frame = CGRectMake(5, WIDTH + rect.size.height + 15, 20, 20);
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
